<template>
    <div class="app-container calendar-list-container">
        <!-- 搜索框，对工段信息进行搜索 -->
      <div class="filter-container">
        <el-button
        icon="el-icon-sort"
        type="primary"
        @click="dialogField = true"
        style="margin-right:15px;margin-top:7px"
        class="filter-item"
        v-waves
        >
        字段排序</el-button>
        <el-input
                @keyup.enter.native="getData"
                clearable
                v-model="listQuery.workOrderNo"
                style="width: 150px;margin-right:15px;margin-top:7px"
                class="filter-item"
                placeholder="请输入工单单号"
        ></el-input>
        <el-input
                @keyup.enter.native="getData"
                clearable
                v-model="listQuery.orderType"
                style="width: 150px;margin-right:15px;margin-top:7px"
                class="filter-item"
                placeholder="请输入工单单别"
        ></el-input>
        <!-- style="width: 200px;margin-right:15px;margin-top:7px" -->
        <el-input
                @keyup.enter.native="getData"
                clearable
                v-model="listQuery.orderPlanNo"
                style="margin-right: 15px;margin-top:7px"
                :style="{ width: inputWid(listQuery.orderPlanNo) }"
                class="filter-item"
                placeholder="请输入计划批号"
        ></el-input>
        <el-input
                @keyup.enter.native="getData"
                clearable
                v-model="listQuery.produceNo"
                style="width: 150px;margin-right:15px;margin-top:7px"
                class="filter-item"
                placeholder="请输入产品编号"
        ></el-input>
        <!-- <el-input
                @keyup.enter.native="getData"
                clearable
                v-model="listQuery.technologyNo"
                style="width: 155px;margin-right:15px;margin-top:7px"
                class="filter-item"
                placeholder="请输入产品编号"
        ></el-input> -->
        <el-input
                @keyup.enter.native="getData"
                clearable
                v-model="listQuery.planNo"
                style="margin-right: 15px;margin-top:7px"
                :style="{ width: inputWid(listQuery.planNo) }"
                class="filter-item"
                placeholder="请输入排产序号"
        ></el-input>

        <el-select clearable v-model="listQuery.isWarehouse" placeholder="状态" style="width: 180px;margin-right:15px;margin-top:7px">
          <el-option :value="item" :label="item" v-for="(item,index) in this.isWarehouseList" :key="index"/>
        </el-select>

        <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="getData" style="margin-top:7px">搜索</el-button>
      </div>

          <!-- 表单 -->
    <el-table :data="dealList" v-loading="listLoading" element-loading-text="拼命加载中" stripe border fit highlight-current-row style="width: 100%">
        <el-table-column label="序号" type="index" align="center"/>
        <el-table-column label="工单单号" prop="workOrderNo" align="center"/>
        <el-table-column label="工单单别" prop="orderType" align="center"/>
        <el-table-column label="排产序号" prop="planNo" align="center" width="150px"/>
        <el-table-column label="计划批号" prop="orderPlanNo" align="center" width="150px"/>
        <el-table-column label="客户品号" prop="clientNumber" align="center"/>
        <el-table-column label="产品编号" prop="produceNo" align="center"/>
        <el-table-column label="工段编号" prop="sectionNo" align="center" width="70px"/>
        <el-table-column label="排产数量" prop="planNumber" align="center" width="70px"/>
        <el-table-column label="创建时间" prop="createTime" align="center" width="85px"/>
        <el-table-column label="计划时间" prop="planTime" align="center" width="85px"/>
        <el-table-column label="BOM时间" prop="bomTime" align="center" width="85px"/>
        <el-table-column label="BOM版本" prop="bomVersion" align="center"/>
        <el-table-column label="预计开始时间" prop="estimateStartTime" align="center"/>
        <el-table-column label="备料完成时间" prop="preparationTime" align="center"/>
        <el-table-column label="车间叫料时间" prop="workshopCallTime" align="center"/>
        <el-table-column label="配送完成时间" prop="deliveryCompletionTime" align="center"/>
        <el-table-column label="预计结束时间" prop="estimateEndTime" align="center"/>
        <el-table-column label="预计产量" prop="estimateYield" align="center" width="70px"/>
        <el-table-column label="工作中心" prop="workCenter" align="center"/>
        <el-table-column label="产品名称" prop="produceName" align="center"/>
        <el-table-column label="状态" prop="isWarehouse" align="center">
          <template slot-scope="scope">
            <div class="fx">
              {{
                scope.row.isWarehouse  == '0'? "工单未完成"
                : scope.row.isWarehouse  == '1'? "未入库"
                : scope.row.isWarehouse  == '2'?"已入库"
                : scope.row.isWarehouse  == '3'?"工单待备料"
                : scope.row.isWarehouse  == '4'?"工单材料已齐套"
                : scope.row.isWarehouse  == '5'?"工单待发料"
                : scope.row.isWarehouse  == '6'?"工单已发料"
                : scope.row.isWarehouse  == '7'?"工单已完成":""
              }}
            </div>
          </template>
        </el-table-column>
        <el-table-column label="标准" prop="isStandard" align="center" width="70px">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.isStandard" size="medium" effect="dark" type="success">标准</el-tag>
            <el-tag v-else effect="dark" size="medium" type="info">非标</el-tag>
          </template>
        </el-table-column>
        <!-- 对工单进行修改与删除 -->
        <el-table-column  label="操作" align="left" width="150" v-if="userInfo.roleId == 4 || userInfo.roleId == 0 || userInfo.roleId == 14 || userInfo.roleId == 15 || userInfo.roleId == 9 || userInfo.roleId == 29|| userInfo.roleId == 32|| userInfo.roleId == 42">
          <template slot-scope="scope" >
            <el-button size="mini" type="primary" v-if="userInfo.roleId == 4 || userInfo.roleId == 0 || userInfo.roleId == 14 || userInfo.roleId == 29|| userInfo.roleId == 32|| userInfo.roleId == 42" @click="handleEdit(scope.row)">修改</el-button>
            <el-button size="mini" type="success" v-if="checkStartsWithHW(scope.row.produceNo)" :disabled="scope.row.isWarehouse != 4" @click="ingredients(scope.row)">叫料</el-button>
          </template>
        </el-table-column>
    </el-table>

       <!-- pagination 分页 -->
    <div class="pagination-container">
      <el-pagination
        background
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="listQuery.page"
        :page-sizes="[5,10, 20, 30, 40,100,300,500]"
        :page-size="listQuery.limit"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
    </div>

     <el-divider></el-divider>

    <el-button type="success" size="small" @click="hExportExcel">导出数据Excel</el-button>

    <!-- 修改工单信息弹出表单 -->
    <el-dialog title="工单信息修改" :visible.sync="dialogFormVisible" width="700px">
    <el-form :model="modifyform">
      <el-form-item label="计划时间" :label-width="formLabelWidth">
         <el-date-picker
         v-model="modifyform.planTime"
         format="yyyy-MM-dd HH:mm:ss"
         value-format="yyyy-MM-dd HH:mm:ss"
         type="datetime"
         placeholder="选择日期时间"
         style="width:400px" />
      </el-form-item>
      <el-form-item label="工段编号" :label-width="formLabelWidth">
        <el-input v-model="modifyform.sectionNo" style="width:400px" />
      </el-form-item>
      <el-form-item label="排产数量" :label-width="formLabelWidth">
        <el-input v-model="modifyform.planNumber" style="width:400px" />
      </el-form-item>
      <el-form-item label="预计结束时间" :label-width="formLabelWidth">
        <el-date-picker
          v-model="modifyform.estimateEndTime"
          format="yyyy-MM-dd"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="date"
          placeholder="选择日期"
          style="width:300px">
        </el-date-picker>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="dialogFormVisible = false">取 消</el-button>
      <el-button type="primary" @click="modifyOrderInfo">确 定</el-button>
    </div>
    </el-dialog>

    <el-dialog title="字段排序" :visible.sync="dialogField">
    <el-row :gutter="10">
      <el-form :inline="true" label-width="112px" :model="sortField" ref="sortField" style="width: 100%">
        <el-col :xs="8" :sm="8" :md="8" :lg="8" :xl="8">
          <el-form-item label="工单单号" :label-width="formLabelWidth" prop="work_order_no">
            <el-select clearable v-model="sortField.work_order_no" placeholder="排序方式" >
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="计划批号" :label-width="formLabelWidth" prop="order_plan_no">
            <el-select clearable v-model="sortField.order_plan_no" placeholder="排序方式" >
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="排产数量" :label-width="formLabelWidth" prop="plan_number">
            <el-select clearable v-model="sortField.plan_number" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="BOM时间" :label-width="formLabelWidth" prop="bom_time">
            <el-select clearable v-model="sortField.bom_time" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="预计结束时间" :label-width="formLabelWidth" prop="estimate_end_time">
            <el-select clearable v-model="sortField.estimate_end_time" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="产品名称" :label-width="formLabelWidth" prop="produce_name">
            <el-select clearable v-model="sortField.produce_name" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :xs="8" :sm="8" :md="8" :lg="8" :xl="8">
          <el-form-item label="工单单别" :label-width="formLabelWidth" prop="order_type">
            <el-select clearable v-model="sortField.order_type" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="产品编号" :label-width="formLabelWidth" prop="produce_no">
            <el-select clearable v-model="sortField.produce_no" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="创建时间" :label-width="formLabelWidth" prop="create_time">
            <el-select clearable v-model="sortField.create_time" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="BOM版本" :label-width="formLabelWidth" prop="bom_version">
            <el-select clearable v-model="sortField.bom_version" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="预计产量" :label-width="formLabelWidth" prop="estimate_yield">
            <el-select clearable v-model="sortField.estimate_yield" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="状态" :label-width="formLabelWidth" prop="is_warehouse">
            <el-select clearable v-model="sortField.is_warehouse" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :xs="8" :sm="8" :md="8" :lg="8" :xl="8">
          <el-form-item label="排产序号" :label-width="formLabelWidth" prop="plan_no">
            <el-select clearable v-model="sortField.plan_no" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="工段编号" :label-width="formLabelWidth" prop="section_no">
            <el-select clearable v-model="sortField.section_no" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="计划时间" :label-width="formLabelWidth" prop="plan_time">
            <el-select clearable v-model="sortField.plan_time" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="预计开始时间" :label-width="formLabelWidth" prop="estimate_start_time">
            <el-select clearable v-model="sortField.estimate_start_time" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="工作中心" :label-width="formLabelWidth" prop="work_center">
            <el-select clearable v-model="sortField.work_center" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

          <el-form-item label="标准" :label-width="formLabelWidth" prop="is_standard">
            <el-select clearable v-model="sortField.is_standard" placeholder="排序方式">
              <el-option :value="item" :label="item" v-for="(item,index) in this.sortUpDown" :key="index"/>
            </el-select>
          </el-form-item>

        </el-col>
      </el-form>
    </el-row>

    <div slot="footer" class="dialog-footer">
      <el-button @click="cancel">取 消</el-button>
      <el-button type="primary" @click="submitSortField">确 定</el-button>
    </div>
    </el-dialog>

    </div>
</template>

<script>
import { getOrderList, changeOrderInfo } from '../../api/productionPlan'
import { saveWorkshopCallTime } from '../../api/processRoute'
export default {
    name: 'check_sPlan',
    data() {
        return {
            listQuery: {                                //搜索的内容表单
                workOrderNo: '',                        //工单单号
                orderType: '',                          //工单单别
                orderPlanNo:'',                         //计划批号
                produceNo: '',                          //产品编号
                produceName: '',                        //产品名称
                technologyNo: '',                       //产品编号
                planNo: '',                             //排产序号
                page: 1,
                limit: 10
            },
            total: 0,  //总的信息条数
            modifyform: {                               //修改按钮需要修改的表单
                planId: '',                             //?
                planTime: '',                           //计划时间
                sectionNo: '',                          //工段编号
                planNumber: '',                          //排产数量
                estimateEndTime: ''                      //预计结束时间
            },
            dealList: [],                               //table表单的信息
            dialogFormVisible: false,                   // 弹框显示的判断条件
            formLabelWidth: '100px',                    //信息修改表单输入框的长度控制
            listLoading: false,                          //table加载的动画控制条件
            userInfo: this.$store.state.user.userInfo,
            isWarehouseList: ['未完工','未入库','已入库','工单待备料','工单材料已齐套','工单待发料','工单已发料','工单已完成'],
            props: { multiple: true },
            fieldList: [
              {
              value: 'work_order_no',
              label: '工单单号',
                children: [
                  { value: 'asc',label: '升序' },
                  { value: 'desc',label: '降序' }
                ]
              },
              {
              value: 'order_type',
              label: '工单单别',
                children: [
                  { value: 'asc',label: '升序' },
                  { value: 'desc',label: '降序' }
                ]
              },
              {
              value: 'plan_no',
              label: '排产序号',
                children: [
                  { value: 'asc',label: '升序' },
                  { value: 'desc',label: '降序' }
                ]
              },
            ],
            sortUpDown: ['升序','降序'],
            dialogField: false,
            sortField: {},

        }
    },
    computed: {
      inputWid() {
        return function (value) {
            if(!value || (value.length <= 10)){
              return '150px'
            } else {
              return (150 + (String(value).length-10)*6) + 'px'
            }
        }
      }
    },
    methods: {
      checkStartsWithHW(str) {
      return str.startsWith('HW');
    },
      // 点击叫料
      async ingredients(row){
        const res = await saveWorkshopCallTime({orderType:row.orderType,workOrderNo:row.workOrderNo})
        // console.log(res);
            if(res.code == '1'){
              this.$message({
              message: res.msg,
              type: 'success'
            })
            this.handleFilter()
            } else {
            this.$message({
              message: res.msg,
              type: 'warning'
            })
          }
      },
        transformDat(res) {
          const mapInfo = {
            workOrderNo: '工单单号',
            orderType: '工单单别',
            planNo: '排产序号',
            orderPlanNo: '计划批号',
            produceNo: '产品编号',
            sectionNo: '工段编号',
            planNumber: '排产数量',
            createTime: '创建时间',
            planTime: '计划时间',
            bomTime: 'BOM时间',
            bomVersion: 'BOM版本',
            estimateStartTime: '预计开始时间',
            estimateEndTime: '预计结束时间',
            estimateYield: '预计产量',
            workCenter: '工作中心',
            produceName: '产品名称',
            isStandard: '标准',
          }
          // 对data进行格式化
          // 取出所有的属性名
          const props = Object.keys(res[0]) // ['id','']
          // 将属性名从英文转为中文
          const header = props.map(zhkey => mapInfo[zhkey])
          const data = res.map(obj => Object.values(obj))
          return { header, data }
        },
        // 导出excel
        async hExportExcel() {
          let query = Object.assign({},this.listQuery)
          query.page = 1
          query.limit = 10000
          query.isWarehouse = this.listQuery.isWarehouse == '未完工'?0:
                              this.listQuery.isWarehouse == '未入库'?1:
                              this.listQuery.isWarehouse == '已入库'?2:
                              this.listQuery.isWarehouse == '工单待备料'?3:
                              this.listQuery.isWarehouse == '工单材料已齐套'?4:
                              this.listQuery.isWarehouse == '工单待发布'?5:
                              this.listQuery.isWarehouse == '工单已发布'?6:
                              this.listQuery.isWarehouse == '工单已完成'?7:''
          // if(query.isWarehouse == ''){ delete query.isWarehouse }
          console.log('%c导出excel传的参数query:','color:green;font-size:16px;')
          console.log(query)
          // if(this.userInfo.departmentName == '喷涂车间') { query.isSpray = true }
          let arr = await getOrderList(query)
          let workOrderNoString = query.workOrderNo?'工单单号' + query.workOrderNo + '-':''
          let orderTypeString = query.orderType?'工单单别' + query.orderType + '-':''
          let produceNoString = query.produceNo?'产品编号' + query.produceNo + '-':''
          let planNoString = query.planNo?'排产序号' + query.planNo + '-':''
          let nameLengthen = workOrderNoString + orderTypeString + produceNoString + planNoString
          arr.data.records.forEach(item => {
              delete item.adminId
              delete item.bomTimeStr
              delete item.estimateEndTimeStr
              delete item.estimateStartTimeStr
              delete item.exemption
              delete item.isEnd
              delete item.isOnlined
              delete item.notStandard
              delete item.notStandardCheck
              delete item.orderTime
              delete item.orderTimeStr
              delete item.planId
              delete item.qeNumber
              delete item.specification
              delete item.surplusAmount
          });
          const { header, data } = this.transformDat(arr.data.records)
            import('@/vendor/Export2Excel').then(excel => {
            // excel表示导入的模块对象
            console.log(excel)
            excel.export_json_to_excel({
            header, // 表头 必填
            data, // 具体数据 必填
            filename: nameLengthen + '生产排产excel', // 文件名称
            autoWidth: true, // 宽度是否自适应
            bookType: 'xlsx' // 生成的文件类型
            })
          })
        },
        async handleFilter() {
          // console.log('一次')
            this.listLoading = true
            let query = Object.assign({},this.listQuery)
            query.isWarehouse = this.listQuery.isWarehouse == '未完工'?0:
                              this.listQuery.isWarehouse == '未入库'?1:
                              this.listQuery.isWarehouse == '已入库'?2:
                              this.listQuery.isWarehouse == '工单待备料'?3:
                              this.listQuery.isWarehouse == '工单材料已齐套'?4:
                              this.listQuery.isWarehouse == '工单待发布'?5:
                              this.listQuery.isWarehouse == '工单已发布'?6:
                              this.listQuery.isWarehouse == '工单已完成'?7:''
            // if(this.userInfo.departmentName == '喷涂车间') { query.isSpray = true }
            if(this.listQuery.sort && this.listQuery.sort.length) {
              query.sort = this.listQuery.sort.join(',')
            }
            // console.log(query)
            const {data} = await getOrderList(query)
            this.dealList = data.records
            console.log(this.dealList);
            this.total = data.total
            this.listLoading = false
        },
        // 对工单信息修改，点击修改按钮显示弹窗
        handleEdit(item) {
            this.modifyform = Object.assign({},item)
            this.dialogFormVisible = true
        },
        // 弹出窗确定按钮，修改工单信息
        async modifyOrderInfo() {
            this.dialogFormVisible = false
            let query = Object.assign({},this.modifyform)
            // if(this.userInfo.departmentName == '喷涂车间') { query.isSpray = true }
            const data = await changeOrderInfo(query)
            const errormsg = data.msg
            if(data.code == '1'){
              this.$message({
              message: '修改成功',
              type: 'success'
            })
            this.handleFilter()
            } else {
            this.$message({
              message: errormsg,
              type: 'warning'
            })
          }
        },
        submitSortField(){
          this.listQuery.sort = []
          if(this.sortField.work_order_no){
            let str = 'work_order_no' + ' ' + this.sortShun(this.sortField.work_order_no)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.order_type){
            let str = 'order_type' + ' ' + this.sortShun(this.sortField.order_type)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.plan_no){
            let str = 'plan_no' + ' ' + this.sortShun(this.sortField.plan_no)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.order_plan_no){
            let str = 'order_plan_no' + ' ' + this.sortShun(this.sortField.order_plan_no)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.produce_no){
            let str = 'produce_no' + ' ' + this.sortShun(this.sortField.produce_no)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.plan_number){
            let str = 'plan_number' + ' ' + this.sortShun(this.sortField.plan_number)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.create_time){
            let str = 'create_time' + ' ' + this.sortShun(this.sortField.create_time)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.plan_time){
            let str = 'plan_time' + ' ' + this.sortShun(this.sortField.plan_time)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.bom_time){
            let str = 'bom_time' + ' ' + this.sortShun(this.sortField.bom_time)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.bom_version){
            let str = 'bom_version' + ' ' + this.sortShun(this.sortField.bom_version)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.estimate_start_time){
            let str = 'estimate_start_time' + ' ' + this.sortShun(this.sortField.estimate_start_time)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.estimate_end_time){
            let str = 'estimate_end_time' + ' ' + this.sortShun(this.sortField.estimate_end_time)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.estimate_yield){
            let str = 'estimate_yield' + ' ' + this.sortShun(this.sortField.estimate_yield)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.work_center){
            let str = 'work_center' + ' ' + this.sortShun(this.sortField.work_center)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.produce_name){
            let str = 'produce_name' + ' ' + this.sortShun(this.sortField.produce_name)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.is_warehouse){
            let str = 'is_warehouse' + ' ' + this.sortShun(this.sortField.is_warehouse)
            this.listQuery.sort.push(str)
          }
          if(this.sortField.is_standard){
            let str = 'is_standard' + ' ' + this.sortShun(this.sortField.is_standard)
            this.listQuery.sort.push(str)
          }
          this.dialogField = false
          this.handleFilter()
        },
        cancel(){
          this.dialogField = false
          this.$refs['sortField'].resetFields()
        },
        sortShun(value){
          return value=='升序'?'asc':'desc'
        },
        getData() {
            this.listQuery.page = 1
            this.listQuery.limit = 10
            this.handleFilter()
        },
        handleSortField(value){
        },
        handleSizeChange(val) {
            this.listQuery.limit = val
            this.handleFilter()
        },
        handleCurrentChange(val) {
            this.listQuery.page = val
            this.handleFilter()
        }
    },
      // 在生命周期函数调用"搜索"按钮绑定的函数，显示已有的数据
    mounted() {
        this.handleFilter()
  },
}
</script>

<style>

</style>
